﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using XXX.Models.XXXEntities;
using XXX.Bo;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace XXX.api.Controllers
{


    [Route("api/wms/[controller]")]
    [ApiController]
    //[Authorize]
    public class ST_GetTransVouchController : ControllerBase
    {
        //private readonly IKuCunReqRepository _invRepository;
        private readonly ILogger<ST_GetTransVouchController> _logger;
        public ST_GetTransVouchController(ILogger<ST_GetTransVouchController> logger)
        {
            //_invRepository = xxxRepository;
            _logger = logger;
        }

        /// <summary>
        /// ccode =0，代表全部
        /// </summary>
        /// <param name="ccode"></param>
        /// <returns></returns>
        [HttpGet]
        public Models.RetModel Get(string corg, string ccode,string cwhcode)
        {
            Models.RetModel ret = DBService.ST_GetTransVouch(corg, ccode, cwhcode);

            return ret;
            //return ReturnStd.Success(jsonstr);
        }

    }

    /// <summary>
    /// 审核调拨单
    /// </summary>
    [Route("api/wms/[controller]")]
    [ApiController]
    //[Authorize]
    public class ST_VerifyTransVouchController : ControllerBase
    {
        //private readonly IKuCunReqRepository _invRepository;
        private readonly ILogger<ST_VerifyTransVouchController> _logger;
        public ST_VerifyTransVouchController(ILogger<ST_VerifyTransVouchController> logger)
        {
            //_invRepository = xxxRepository;
            _logger = logger;
        }


        [HttpPost]
        public Models.RetModelbool Post(PuArrivalBarcode model)
        {

            Models.RetModelbool ret = WMSService.ST_VerifyTransVouch(model);

            return ret;
            //return ReturnStd.Success(jsonstr);
        }

    }

    /// <summary>
    /// 查询未审核的材料出库单
    /// </summary>
    [Route("api/wms/[controller]")]
    [ApiController]
    //[Authorize]
    public class ST_GetMaterialOutController : ControllerBase
    {
        //private readonly IKuCunReqRepository _invRepository;
        private readonly ILogger<ST_GetMaterialOutController> _logger;
        public ST_GetMaterialOutController(ILogger<ST_GetMaterialOutController> logger)
        {
            //_invRepository = xxxRepository;
            _logger = logger;
        }
        [HttpGet]
        public Models.RetModel Get(string corg,string ccode,string cwhcode)
        {
            Models.RetModel ret = DBService.ST_GetMaterialOut(corg,ccode, cwhcode);

            return ret;
            //return ReturnStd.Success(jsonstr);
        }
    }

    /// <summary>
    /// 查询未审核的材料出库单（红字）
    /// </summary>
    [Route("api/wms/[controller]")]
    [ApiController]
    //[Authorize]
    public class ST_GetMaterialOut2Controller : ControllerBase
    {
        //private readonly IKuCunReqRepository _invRepository;
        private readonly ILogger<ST_GetMaterialOut2Controller> _logger;
        public ST_GetMaterialOut2Controller(ILogger<ST_GetMaterialOut2Controller> logger)
        {
            //_invRepository = xxxRepository;
            _logger = logger;
        }
        [HttpGet]
        public Models.RetModel Get(string corg, string ccode, string cwhcode)
        {
            Models.RetModel ret = DBService.ST_GetMaterialOut2(corg, ccode, cwhcode);

            return ret;
            //return ReturnStd.Success(jsonstr);
        }
    }

    /// <summary>
    /// 审核材料出库单
    /// </summary>
    [Route("api/wms/[controller]")]
    [ApiController]
    //[Authorize]
    public class ST_VerifyMaterialOutController : ControllerBase
    {
        //private readonly IKuCunReqRepository _invRepository;
        private readonly ILogger<ST_VerifyMaterialOutController> _logger;
        public ST_VerifyMaterialOutController(ILogger<ST_VerifyMaterialOutController> logger)
        {
            //_invRepository = xxxRepository;
            _logger = logger;
        }


        [HttpPost]
        public Models.RetModelbool Post(PuArrivalBarcode model)
        {

            Models.RetModelbool ret = WMSService.ST_VerifyMaterialOut(model);

            return ret;
            //return ReturnStd.Success(jsonstr);
        }

    }



    /// <summary>
    /// 审核其他出库单
    /// </summary>
    [Route("api/wms/[controller]")]
    [ApiController]
    //[Authorize]
    public class MaterialOutRD09VerifyController : ControllerBase
    {
        //private readonly IKuCunReqRepository _invRepository;
        private readonly ILogger<MaterialOutRD09VerifyController> _logger;
        public MaterialOutRD09VerifyController(ILogger<MaterialOutRD09VerifyController> logger)
        {
            //_invRepository = xxxRepository;
            _logger = logger;
        }


        [HttpPost]
        public Models.RetModelbool Post(ScanBarcode model)
        {

            Models.RetModelbool ret = WMSService.MaterialOutRD09Verify(model);

            return ret;
            //return ReturnStd.Success(jsonstr);
        }

    }

}
